
import requests


def ai_method(question):

    # 填写你的 API Key
    API_KEY = "sk-cf6e9964c3be42288b1f850a23b8ad6e"

    url = "https://api.deepseek.com/chat/completions"
    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {API_KEY}"
    }
    data = {
        "model": "deepseek-reasoner",  # 指定使用 R1 模型（deepseek-reasoner）或者 V3 模型（deepseek-chat）
        "messages": [
            {"role": "system", "content": "你是一个专业的助手"},
            {"role": "user", "content": question}
        ],
        "stream": False  # 关闭流式传输
    }

    response = requests.post(url, headers=headers, json=data)

    if response.status_code == 200:

        result = response.json()
        print(result['choices'][0]['message']['content'])
    else:
        print("请求失败，错误码：", response.status_code)


aa = """
两个数字比较大小
参数: num1 数字1   num2 数字2
输出大的数字
def max_num(num1,num2):

    if num1 > num2:

        print("第一个数字大")

    elif num1 < num2:

        print("第二个数字大")

    else:

            print("两个数字相等")
"""
aa_plus = f"以下是一个 Python 函数代码，请为其生成单元测试用例：\n\n{aa}\n\n测试用例："
ai_method(aa_plus)